package com.aooci.ordercat.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.aooci.ordercat.enums.OrderStatus;
import com.aooci.ordercat.enums.OrderType;
@Entity
@Table(name = "ORDERCAT")
@NamedQueries({
    @NamedQuery(name="ORDERCAT.selectByAttributes",
                query="SELECT oc FROM Ordercat oc WHERE YEAR(oc.creationTimestamp) = :year AND MONTH(oc.creationTimestamp) = :month AND DAY(oc.creationTimestamp) = :day AND oc.status = :status ORDER BY oc.id"),
    @NamedQuery(name="ORDERCAT.selectByAcrossDayConditons",
                query="SELECT oc FROM Ordercat oc WHERE (YEAR(oc.creationTimestamp) =:selectedYear AND MONTH(oc.creationTimestamp) =:selectedMonth AND DAY_OF_MONTH(oc.creationTimestamp) =:selectedDay AND oc.status = :status AND HOUR(oc.creationTimestamp) > :divideTime) OR (YEAR(oc.creationTimestamp) =:nextYear AND MONTH(oc.creationTimestamp) =:nextMonth AND DAY_OF_MONTH(oc.creationTimestamp) =:nextDay AND oc.status = :status AND HOUR(oc.creationTimestamp) < :divideTime) ORDER BY oc.id"),
}) 
//@NamedQuery(name = "ORDERCAT.selectByAttributes", query = "SELECT oc FROM Ordercat oc WHERE YEAR(oc.creationTimestamp) = :year AND MONTH(oc.creationTimestamp) = :month AND DAY(oc.creationTimestamp) = :day AND oc.status = :status ORDER BY oc.id")
public class Ordercat extends VersionableEntity implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Enumerated(EnumType.STRING)
	@Column(name = "TYPE")
	private OrderType type;
	
	@Enumerated(EnumType.STRING)
	@Column(name = "STATUS")
	private OrderStatus status;
	
	@Column(name = "PRINT_COUNT")
	private int printCount;
	
	@Column(name = "TOTAL")
	private float total;

	/**
	 * @return the type
	 */
	public OrderType getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(OrderType type) {
		this.type = type;
	}

	/**
	 * @return the status
	 */
	public OrderStatus getStatus() {
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(OrderStatus status) {
		this.status = status;
	}

	/**
	 * @return the total
	 */
	public float getTotal() {
		return total;
	}

	/**
	 * @param total the total to set
	 */
	public void setTotal(float total) {
		this.total = total;
	}

	/**
	 * @return the printCount
	 */
	public int getPrintCount() {
		return printCount;
	}

	/**
	 * @param printCount the printCount to set
	 */
	public void setPrintCount(int printCount) {
		this.printCount = printCount;
	}
}
